package com.spring.bean.factorybean;

import org.junit.Test;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.test.context.ContextConfiguration;

/**
 * @ClassName: FactoryBeanTest
 * @Author: suncx
 * @CreateDate: 2020-04-04 12:38
 * @Description:
 */
@ContextConfiguration(locations = { "classpath:log4j2.xml" })
public class FactoryBeanTest {
    @Test
    public void beanFactoryTest() {
        BeanFactory bf = new XmlBeanFactory(new ClassPathResource("/bean/FactoryBeanTest.xml"));
        Car car1 = (Car)bf.getBean("car");
        Car car2 = (Car)bf.getBean("car");
        System.out.println(car1);
        System.out.println(car1==car2);

    }
}
